<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<link href="../favicon.ico" rel="icon" type="image/x-icon" />
		<title>BOS管理系统首页</title>
		<script type="text/javascript" src="../js/jquery-1.8.3.js"></script>
		<script type="text/javascript" src="../js/easyui/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="../js/easyui/locale/easyui-lang-zh_CN.js"></script>
		<link rel="stylesheet" id="theme" href="../js/easyui/themes/default/easyui.css" />
		<link rel="stylesheet" href="../js/easyui/themes/icon.css" />
		<!-- 导入ztree类库 -->
		<script src="../js/ztree/jquery.ztree.all-3.5.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="../js/ztree/zTreeStyle.css"/>
		<script type="text/javascript">
			$(function(){
				// 1、 进行ztree菜单设置 
				var setting = {
					data : {
						simpleData : { // 简单数据 
							enable : true
						}
					},
					callback : {
						onClick : zTreeOnClick
					}
				};
				
				// 2、提供ztree树形菜单数据 
				var zNodes = [
					{id:1,pId:0,name:"基础数据"},
					{id:11,pId:1,name:"基础档案设置"},
					{id:12,pId:1,name:"收派标准"},
					{id:13,pId:1,name:"班车管理"},
					{id:14,pId:1,name:"快递员设置/替班"},
					{id:15,pId:1,name:"区域设置"},
					{id:16,pId:1,name:"管理分区"},
					{id:17,pId:1,name:"管理定区/调度排班"},
					{id:18,pId:1,name:"收派时间管理"},
					{id:2,pId:0,name:"受理"},
					{id:21,pId:2,name:"业务受理"},
					{id:21,pId:2,name:"运单快速录入"},
					{id:21,pId:2,name:"运单录入"},
					{id:21,pId:2,name:"运单导入"},
					{id:21,pId:2,name:"运单管理"},
					{id:3,pId:0,name:"调度"},
					{id:31,pId:3,name:"查台账单"},
					{id:31,pId:3,name:"人工调度"},
					{id:31,pId:3,name:"签收录入"},
					{id:4,pId:0,name:"分拣管理"},
					{id:41,pId:4,name:"入库"},
					{id:42,pId:4,name:"出库"},
					{id:42,pId:4,name:"盘库"},
					{id:42,pId:4,name:"合包"}
				];
				
				// 3、生成菜单
				$.fn.zTree.init($("#basetree"), setting, zNodes);
				
			var currentRightTitle
			//右键菜单
			$('#tabs').tabs({
				onContextMenu : function(e,title,index){
						currentRightTitle = title ; 
						$('#meau').menu('show', { 
							left: e.pageX,
							top: e.pageY 
						});
						e.preventDefault(); // 禁用原来的右键效果 
					}
				});
				
				
			//右键菜单实现
			$('#meau').menu({
				onClick:function(item){ 
					if (item.id==="close" && currentRightTitle != '消息中心') {
						$('#tabs').tabs("close",currentRightTitle);
					}
					if (item.id==="closeother") {
						var tabs = $('#tabs').tabs("tabs");
						$(tabs).each(function(i,n){
							var tabtitle = n.panel('options').title;
							if (tabtitle != '消息中心' && tabtitle != currentRightTitle) {
								$('#tabs').tabs("close",tabtitle);
							}
						})
					}
					if (item.id==="closeall") {
						var tabs = $('#tabs').tabs("tabs");
						$(tabs).each(function(i,n){
							var tabtitle = n.panel('options').title;
							if (tabtitle != '消息中心') {
								$('#tabs').tabs("close",tabtitle);
							}
						})
					}
				} 
			});
			
			//右下角窗口
			
			window.setTimeout(function(){
				$.messager.show({  	
				  title:'消息提示',  
				  width:300,
				  height:150,
				  msg:'<center>欢迎登录，超级管理员！<a href="http://www.baidu.com">联系管理员</a></center>',  	
				  timeout:5000,  	
				  showType:'fade'  
				});
			},2000);
			});
			
			
			
			//树形菜单点击事件
			function zTreeOnClick(event, treeId, treeNode) {
		    	
		    	if(treeNode.pId!=null){
		    		if($("#tabs").tabs("exists",treeNode.name)){
		    			$("#tabs").tabs("select",treeNode.name)
		    		}else{
		    			$('#tabs').tabs('add',{ 
						title:treeNode.name, 
						content:'<div style="width:100%;height:100%;overflow:hidden;"><iframe src="http://www.baidu.com" style="width: 100%;height: 100%;"></iframe></div>', 
						closable:true, 
						tools:[{ 
							iconCls:'icon-reload', 
							handler : function(){ 
								$(this).panel('open').panel('refresh');
							} 
						
						}] 

					}); 
		    		}
		    	}
			};
			//更换皮肤
			function changeTheme(themeName){
				var href = $("#theme").attr('href').substring(0, $("#theme").attr('href').lastIndexOf("themes"))+ 'themes/'
						+ themeName + '/easyui.css';
				$("#theme").attr("href",href);
				var iframes = $('iframe');
				if(iframes.length>0){
					for (var i = 1 ;i<=iframes.length;i++) {
						$(iframes[i]).contains().find("#theme").attr("href",href);
					}
				}
			}
			//弹出修改密码对话框
			function changepassword(){
				$("#changepassword").window("open");
			}
			
			
			//验证密码
			$.extend($.fn.validatebox.defaults.rules, { 
				equals: { 
					validator: function(value,param){ 
						return value == $(param[0]).val(); 
					}, 
					message: '密码输入不一致' 
				} 
			}); 
			//提交密码修改
			function submit(){
				$('#ff').form('submit', { 
					url:"", 
					onSubmit: function(){ 
						return $(this).form('validate'); 
					}, 
					success:function(data){ 
						var data = eval('(' + data + ')'); // change the JSON string to javascript object 
						if (data.success){ 
							$.messager.alert('Success',data.messager); 
						} 
					} 
				}); 
			}
			
			// 版权信息
			function showAbout(){
				$.messager.alert("bos v2.0综合物流管理平台","设计: 传智播客<br/> 管理员邮箱: itcast_search@163.com <br/>");
			}
			
			
			// 退出登录
			function logoutFun() {
				$.messager
				.confirm('系统提示','您确定要退出本次登录吗?',function(isConfirm) {
					if (isConfirm) {
						location.href = './login.html';
					}
				});
			}
		</script>
	</head>

	<body class="easyui-layout">

		<div data-options="region:'north',split:true" style="height:80px;">
			<img src="../images/logo.png" style="margin-top: 1%;margin-left: 2%;" />
			<div style="float: right; margin-top: 1.3%;margin-right: 2%;">
				<div>超级管理员</div>
				<div>
					<a href="javascript:void(0)" id="mb" class="easyui-menubutton" data-options="menu:'#replaceskin',iconCls:'icon-edit'">更换皮肤</a>
					<div id="replaceskin" style="width:150px;"> 
						<div onclick="changeTheme('default')">default</div>
						<div onclick="changeTheme('gray')">gray</div>
						<div onclick="changeTheme('black')">black</div>
						<div onclick="changeTheme('bootstrap')">bootstrap</div>
						<div onclick="changeTheme('metro')">metro</div>
					</div>
					<a href="javascript:void(0)" id="mb" class="easyui-menubutton" data-options="menu:'#controlpanel',iconCls:'icon-help'">控制面板</a>
					<div id="controlpanel" style="width:150px;"> 
						<div onclick="changepassword()">修改密码</div>
						<div onclick="showAbout();">联系管理员</div>
						<div class="menu-sep"></div>
						<div onclick="logoutFun();">退出系统</div>
					</div>
				</div>
			</div>
		</div>
		<div data-options="region:'west',title:'菜单导航'" style="width: 180px;">
			<div class="easyui-accordion" fit="true" border="false">
				<div title="基本功能" style="width: 100%;height: 100%; border: 0;">
					<ul class="ztree" id="basetree">
						
					</ul>
				</div>

				<div title="系统管理">
					<ul class="ztree" id="systemtree">
						
					</ul>
				</div>
			</div>
		</div>
		<div data-options="region:'center'">
			<div id="tabs" class="easyui-tabs" style="width:500px;height:250px;" fit="true">
				<div title="消息中心" style="padding:20px;display:none;">tab1 </div>
			</div>

		</div>
		<div data-options="region:'south'" style="height: 80px;">底部区域</div>
		
		<!--
        	作者：756958289@qq.com
        	时间：2017-08-13
        	描述：弹出窗口
        -->
		<div id="changepassword" class="easyui-window" title="修改密码" closed=true maximizable=false minimizable=false collapsible=false  style="width: 300px; height: 160px; padding: 5px; data-options="iconCls:'icon-save',modal:true"> 
			<div class="easyui-layout" fit="true">
				<form id="ff" method="post"> 
					<div region="center" border="false" style="padding: 10px; background: #fff; border: 1px solid #ccc;">
						<table cellpadding=3>
							<tr>
								<td>新密码：</td>
								<td>
									<input id="pwd" name="pwd" type="password" class="easyui-validatebox" data-options="required:true"/>
								</td>
							</tr>
							<tr>
								<td>确认密码：</td>
								<td>
									<input id="rpwd" name="rpwd" type="password" class="easyui-validatebox" required="required" validType="equals['#pwd']" /> 
								</td>
							</tr>
						</table>
					</div>
					<div region="south" border="false" style="text-align: right; height: 30px; line-height: 20px;padding-top: 6px;">
						<a  onclick="submit()" class="easyui-linkbutton" data-options="iconCls:'icon-save'">保存</a>
					</div>
				</form>
			</div>
		</div>
		<!--
        	作者：756958289@qq.com
        	时间：2017-08-14
        	描述：右键菜单
        -->
        <div id="meau" class="easyui-menu" style="width: 120px;">
        	
        	<div id="close">关闭当前页面</div>
        	<div id="closeother">关闭其他页面</div>
        	<div class="menu-sep"></div>
        	<div id="closeall" data-options="iconCls:'icon-cancel'">关闭所有页面</div>
        </div>
        
        
	</body>

</html>